<extend name="Layout/ins_page" />
<block name="content">
    <link href="/sap/demo.css" rel="stylesheet" type="text/css" />
    <script src="/sap/scripts/boot.js" type="text/javascript"></script>
    <style>
		table img{width: 40px}
	</style>
<body style="">    
  <div class='show-pic'><img /></div>
  <div id="form1" >
    <table style="width:100%;height:100%;">
        <tr>
            <td >
           	
             	<span class='span'>查询物料名，物料号:</span>  <input type="input" class='mini-textbox' id='key' name='key' style="width: 180px"/>
              <a class="mini-button" iconCls="icon-search" onclick="search()" style="margin-left: -9px"></a>
                <br>

                类型:<select class="mini-combobox" name="type" id="type">
                <option value="0">普通</option>
                <option value="1">活动</option>
                <option value="2">集采</option>
            </select>

                选择平台:<input id="btnEdit1" class="mini-buttonedit" onbuttonclick="onButtonEdit" name="" textName=""/>

              	<input id="combo1" onValuechanged="change()" class="mini-combobox" style="width:320px;" textField="name" valueField="id" emptyText="请选择清单..."  url="/Shelves/getMylist" value=""  allowInput="true" showNullItem="true" nullItemText="请选择清单..."/>
                <a class="mini-button" iconCls="icon-add" onclick="promptClick()">创建清单</a>
                <a class="mini-button" iconCls="icon-addnew" onclick="copyList()">复制清单</a>
                <a class="mini-button" iconCls="icon-download" onclick="exportExcel()">导出清单</a>

                <br>

            通知用户:<input id="btnEdit2" class="mini-buttonedit" onbuttonclick="onButtonEditB" style="width: 30%" text="" value=""/>
                备注:<input id="list_remark"  name="list_remark" class="mini-textbox" required="false" width='300px' height="150px" emptyText="图片网盘地址"/>
      		   <a class="mini-button" iconCls="icon-downgrade" onclick="send()">通知上架</a>
            <br/><br/>
                <div id="grid1" class="mini-datagrid" style="width:100%;height:500px;" 
                    idField="id" multiSelect="true" showFilterRow="false" showPager="false"
                    url="goods/queryItemBygoodssearchOA" resultAsData="true" allowCellEdit="true" allowCellSelect="true">
                    <div property="columns">
                        <div type="checkcolumn"></div>
                         <div header="物料编号" field="code" width="80px">
                         <input id="code" property="filter" class="mini-textbox" style="width:100%;" onvaluechanged="onFilterChanged"/>
                         </div>
                         <div header="物料名称" field="name"  width="200px">
                          <input id="name" class="mini-textbox" style="width:100%;" onvaluechanged="onFilterChanged"/>
                         </div>
                          <div header="颜色" field="color"  width="50px">
                          <input id="color" property="filter" class="mini-textbox" style="width:100%;" onvaluechanged="onFilterChanged"/>
                          </div>
                          <!--<div header="图片" field="img"  width="50px"></div>-->
                           <!--<div header="标签" field="tag"  width="">-->
                            <!--<input id="tag" property="filter" class="mini-textbox" style="width:100%;" onvaluechanged="onFilterChanged"/>-->
                           <!--</div>-->
                          <!--<div header="重量" field="weight"  width=""></div>-->
                    </div>
                </div>
            </td>
            <!--   <td style="width:60px;text-align:center;">
                <input type="button" value="添加全部" onclick="addAll()" style="width:80px;"/><br />
                <input type="button" value="移除全部" onclick="removeAll()" style="width:80px;"/><br />
            </td> -->
          
        </tr>
        <tr>
            <td><a class='mini-button' onclick="adds()" style="width:80px;" >添加到清单</a>&nbsp;&nbsp;&nbsp; </td>
            <!--<a class='mini-button'  onclick="settag()" style="width:80px;">设置标签</a>-->
        </tr>
    
    </table>
  </div>

    <!--<div  style="right:0px; top:88px; position:absolute;border: 1px solid #3498db ;width: 20px;height: 80%;padding-top: 20%;padding-left: 2px;cursor: pointer;"id='right-menu'>点我查看清单 </div>-->
    <!--<div style="float: top; width: 700px; position: initial; right: 20px; background-color: rgb(255, 255, 255); box-shadow: rgb(136, 136, 136) -2px 10px 10px; margin-top: -500px; margin-left: 200px; display: block;" id='qdan-show'>-->

        <div id="grid2" class="mini-datagrid" style="width:100%;height:500px;border: 1px solid gray"
                    idField="id"  multiSelect="true" showPager="false"
                    allowCellEdit="true" allowCellSelect="true" onCellendedit='cellendedit'>
                    <div property="columns">
                        <div type="checkcolumn"></div>
                         <div field="code" width="150px">物料编号
                             <input class="mini-textbox" style="width:100%;"/>
                         </div>
                         <div field="name"  width="300px">物料名称
                             <input class="mini-textbox" style="width:100%;"/>
                         </div>
                         <div field="color"  width="50px">颜色
                             <input class="mini-textbox" style="width:100%;"/>
                         </div>
                        <div field="qty"  width="50px">数量
                            <input property="editor" class="mini-textbox" style="width:100%;"/>
                        </div>
                        <!--<div field="BANK_Model" headerAlign="center">规格-->
                            <!--<input class="mini-textbox" style="width:100%;"/>-->
                        <!--</div>-->
                        <div field="pcode"  width="100px">主品物料号
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="maoli"  width="50px">毛利
                            <input class="mini-textbox"/>
                        </div>

                        <div field="mall_price"  width="50px">商城价
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <!--<div field="market_price"  width="50px">市场价-->
                            <!--<input property="editor" class="mini-textbox"/>-->
                        <!--</div>-->

                        <div field="maolilv"  width="50px">毛利率
                            <input class="mini-textbox"/>
                        </div>

                        <div field="purchase_price"  width="100px">SAP采购价
                            <input class="mini-textbox"/>
                        </div>
                        <div field="r_purchase_price"  width="100px">采购价
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="by_stages"  width="50px">分期数
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="by_stages_rate"  width="50px">分期费率(%)
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="weight"  width="50px">重量
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="freight"  width="50px">预估运费
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div type="comboboxcolumn" autoShowPopup="true" name="typeOfShipping" field="typeOfShipping" width="100" allowSort="true"  align="center" headerAlign="center">运输方式
                            <input property="editor" class="mini-combobox" style="width:100%;" data="typeOfShipping" />
                        </div>

                        <div field="gift_price"  width="50px">赠品价格
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="bank_commission"  width="50px">佣金
                            <input class="mini-textbox"/>
                        </div>

                        <div field="zengzhishui"  width="50px">增值税等17%
                            <input class="mini-spinner"/>
                        </div>

                        <div field="packing_charge"  width="50px">包装费
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="rebate"  width="50px">返利金额
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="tamll_price"  width="100px">天猫价
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="tamll_S_AMT"  width="100px">天猫销量
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="tamll"  width="100px">天猫
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="jd_price"  width="100px">京东价
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="jd_S_AMT"  width="100px">京东销量
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="jd"  width="100px">京东
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="guangfa_price"  width="100px">广发价
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="guangfa_S_AMT"  width="100px">广发销量
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="guangfa"  width="100px">广发
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="jianhang_price"  width="100px">建行价
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="jianhang_S_AMT"  width="100px">建行销量
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="jianhang"  width="100px">建行
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="zhaohang_price"  width="100px">招行价
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="zhaohang_S_AMT"  width="100px">招行销量
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="zhaohang"  width="100px">招行
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="jiaohang_price"  width="100px">交行价
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="jiaohang_S_AMT"  width="100px">交行销量
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="jiaohang"  width="100px">交行
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="minsheng_price"  width="100px">民生价
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="minsheng_S_AMT"  width="100px">民生销量
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="minsheng"  width="100px">民生
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="pingan_price"  width="100px">平安价
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="pingan_S_AMT"  width="100px">平安销量
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="pingan"  width="100px">平安
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="zhongxin_price"  width="100px">中信价
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="zhongxin_S_AMT"  width="100px">中信销量
                            <input property="editor" class="mini-textbox"/>
                        </div>
                        <div field="zhongxin"  width="100px">中信
                            <input property="editor" class="mini-textbox"/>
                        </div>

                        <div field="remark"  width="100px">备注
                            <input class="mini-textbox"/>
                        </div>

                          <!--<div header="图片" field="img"  width="50px"></div>-->
                          <!--<div header="重量" field="weight"  width=""></div>-->
                        </div>
                    </div>
  <a class='mini-button' onclick="removes()" style="width:100px;">删除选中物料</a>
  <!--&nbsp;&nbsp;-->
  <!--<a  href='javascript:void(0)' class='close_show' >关闭</a>-->

    <!--</div>-->
    
    <script type="text/javascript">

        $('#qdan-show').hide();

	  jQuery('table img').live('hover',function(event){
		  
		  if(event.type=='mouseenter'){ 
			  jQuery(".show-pic img").attr('src',jQuery(this).attr('src'))
			  jQuery('.show-pic').css({'left':event.pageX+'px','top':'30%'})
			  jQuery(".show-pic").fadeIn(500);
			  }else{ 
					jQuery(".show-pic").hide();
			  }
		}
	  )
    $('#right-menu').toggle(function(){
    	$('#qdan-show').show();
    },
    function(){
    	$('#qdan-show').hide();
    }
    )
        jQuery('.close_show').click(function(){
    	 jQuery('#qdan-show').hide();
    })

    
          function onFilterChanged(e) {
            var namebox = mini.get("name");
            var codebox = mini.get("code");  
            var tagbox = mini.get("tag");  
            var name = namebox.getValue().toLowerCase();
 			var code = codebox.getValue().toLowerCase();
 			var tag  =tagbox.getValue().toLowerCase();
 			  var color = mini.get("color").getValue().toLowerCase();; 
            //多条件组合过滤
            grid1.filter(function (row) {
                //name
                var r1 = true;
                if (namebox) {
                    r1 = String(row.name).toLowerCase().indexOf(name) != -1;
                }

                var r2 = true;
                if (code) {
                    r2 = String(row.code).toLowerCase().indexOf(code) != -1;
                }
                
                var r3 = true;
                if (tag) {
                    r3 = String(row.tag).toLowerCase().indexOf(tag) != -1;
                }
                
                var r4 = true;
                if (color) {
                    r4 = String(row.color).toLowerCase().indexOf(color) != -1;
                }
                
                color
                return r1 && r2&& r3&&r4;
            });
        }
    
    
        mini.parse();
        var grid1 = mini.get("grid1");
        var grid2 = mini.get("grid2");
        grid1.on("drawcell", function (e) {
            var record = e.record,
                column = e.column,
                field = e.field,
                value = e.value;
            	if (field == "img") {
            		
            		 e.cellHtml="<img src='"+record.img+"' class='item-img'>";
          		  }

            });

        function fmt(num) {
            return parseFloat(num);
        }

        grid2.on("drawcell", function (e) {
            var record = e.record,
                column = e.column,
                field = e.field,
                value = e.value;
            	if (field == "img") {
            		 e.cellHtml="<img src='"+record.img+"' class='item-img'>";
          		  }

            if(field == "bank_commission"){
                //银行佣金 = J2 商城价 mall_price * P2 分期费率(%) by_stages_rate
                var bankcommission = (fmt(record.mall_price) * fmt(record.by_stages_rate/100))
                e.cellHtml = bankcommission.toFixed(3);
            }

            if(field == "zengzhishui"){
                //增值税等17% = (J2 商城价 mall_price - M2 采购价 r_purchase_price)*0.07
                var zengzhishui = (fmt(record.mall_price) - fmt(record.r_purchase_price)) *0.07
                e.cellHtml = zengzhishui.toFixed(3);
            }

            if (field == "maoli") {
                //毛利 = J2 商城价 mall_price - M2 采购价 r_purchase_price + V2 返利金额 rebate - Q2 预估运费 freight - R2 赠品价格 gift_price - S2 银行佣金 bank_commission - T2 增值税等17% zengzhishui - U2 包装费 packing_charge
                var maoli = (fmt(record.mall_price) - fmt(record.r_purchase_price) + fmt(record.rebate) - fmt(record.freight) - fmt(record.gift_price) - fmt(record.bank_commission) - fmt(record.zengzhishui) - fmt(record.packing_charge)) ;
                e.cellHtml = maoli.toFixed(3);
            }

            if (field == "maolilv") {
                //毛利率 = I2 毛利 /J2 商城价 mall_price
                var maoli = (fmt(record.mall_price) - fmt(record.r_purchase_price) + fmt(record.rebate) - fmt(record.freight) - fmt(record.gift_price) - fmt(record.bank_commission) - fmt(record.zengzhishui) - fmt(record.packing_charge)) ;
                var maolilv = maoli / fmt(record.mall_price) * 100;
                e.cellHtml = maolilv.toFixed(3);
            }

            if(record.pcode)
                e.cellStyle = "background:#94bad5";
            	
            });
        
        jQuery('.item-img').live('click',function(){
        	window.open(jQuery(this).attr('src'));
        })
   
        grid1.setPageSize(20);
        grid1.load();
        function search(){
        	var key = mini.get('key').getValue();
        	 grid1.load({'key':key});
        }
        function adds() {
        	
        	var id = mini.get('combo1').getValue();
        	if(id==''){
        	mini.alert('请选择清单');
        	return;
        	}
        	var data = new Object();
            var items = grid1.getSelecteds();
            grid1.removeRows(items);
            var selecteds = grid2.getData();
            var check=true;
            var dataIndex=0;
            for(var index=0;index<items.length;index++){
                //允许物料重复
            	 /*for(var sindex=0;sindex<selecteds.length;sindex++){
                 		if(items[index].code==selecteds[sindex].code){
                 			check = false;
                 		}
                 }*/
            	 if(check){
            		 grid2.addRow(items[index]);
            		 data[dataIndex]=items[index];
            		 dataIndex++;
            	 }else{
            		 check = true;
            	 }
            }
           if(data.length==0)return;
           var postData = mini.encode(data);
            $.ajax({
                url: "/Shelves/saveShelvesDetailed",
                type: "post",
                data: { data:postData,pid:id },
                dataType:'json',
                success: function (data) {
                change();
                }
            });
            
            
        }
        function addAll() {
            var items = grid1.getData();       
            grid1.removeRows(items);
            grid2.addRows(items);
        }
        function removes() {
            var items = grid2.getSelecteds();
            var ids = '';
           	for(var index =0;index<items.length;index++){
           		ids+=items[index].id+",";
           	}
           	
            $.ajax({
                url: "/Shelves/delShelvesDetailed",
                type: "post",
                data: {ids:ids },
                dataType:'json',
                success: function (data) {
                }
            });
            grid2.removeRows(items);
          //  grid1.addRows(items);
        }
        function removeAll() {
            var items = grid2.getData();
            grid2.removeRows(items);
            grid1.addRows(items);
        }
        function upItem() {
            var items = grid2.getSelecteds();
            grid2.moveUp(items);
        }
        function downItem() {

            var items = grid2.getSelecteds();
            grid2.moveDown(items);
        }
        function saveData() {
            var data = grid2.getData();
            var json = mini.encode(data);
            alert(json);
        }
        
        function change(){
        
        	var id = mini.get('combo1').getValue();
        	if(id==''){
        		
        		return ;
        	}
        	loadingmsg('加载清单明细..')
        	
            $.ajax({
                 url: "/Shelves/getShelvesDetailed",
                 type: "post",
                 data: { pid: id },
                 dataType:'json',
                 success: function (data) {
                	 colseloading();
                	 grid2.setData(data);
                	 $('#qdan-show').show();
                 }
             });
        	
        }
        
        
        function promptClick() {
          var id = mini.get('btnEdit1').getValue();
          if(id==''){
        	  mini.alert('请选择平台');
        	  return;
          }

            mini.prompt("请输入清单名称：", "请输入",
                function (action, value) {
                    if (action == "ok") {
                    	if(value==''){
                    		mini.alert('名称不能为空');
                    		return;
                    	}
                    	saveshelvesList(value);
                    }

                }
            );
        }
        
        function saveshelvesList(name){
        	addlistData.name = name;

            var form = new mini.Form("#form1");
            var data = form.getData();      //获取表单多个控件的数据
            addlistData.type = data.type;

            $.ajax({
                 url: "/Shelves/saveshelvesList",
                 type: "post",
                 data: { savedata:mini.encode(addlistData) },
                 dataType:'json',
                 success: function (data) {
                	if(data.code!=0){
                		mini.alert('添加成功');
                		mini.get('combo1').setData(data.data);
                		mini.get('combo1').setValue(data.code);
                	} 
                	
                    
                 }
             });
        	
        }
        
        var addlistData = null;
        
        function onButtonEdit(e) {
            var btnEdit = this;
         
            mini.open({
                url:  "/Shelves/select",                          
                title: "选择平台",
                width: 650,
                height: 380,
                ondestroy: function (action) {
                  
                    if (action == "ok") {
                        var iframe = this.getIFrameEl();
                        var data = iframe.contentWindow.GetData();
                        data = mini.clone(data);
                        addlistData = data ;
                        data.listId = mini.get('combo1').getValue();
                        mini.get('btnEdit1').setText(data.text);
                        mini.get('btnEdit1').setValue(data.id);
                        
                    }
                }
            });            
             
        }  
        
        
        function send(){
        	var id = mini.get('combo1').getValue();
        	var userlist = mini.get('btnEdit2').getValue();
        	var listRemark = mini.get('list_remark').getValue();

        	if(id==''){
        	    mini.alert('请选择清单');
        	    return;
        	}
            if(userlist==''){
                mini.alert('请选择通知用户');
                return;
            }
        	loadingmsg('发送中....');
            $.ajax({
                url: "/Shelves/sendnotice",
                type: "post",
                data: { id:id,userlist:userlist,listRemark:listRemark },
                dataType:'json',
                success: function (data) {
                	  mini.unmask(document.body);
                   	  mini.alert(data.msg)
                        // 更新状态
                        change();
               	
                   
                }
            });
        }
        
        function settag(e) {
            var btnEdit = this;
            var rows = grid1.getSelecteds();
            if(rows.length==0){
            	mini.alert('请选择物料');return;
            }
            mini.open({
                url:  "/Shelves/selectTags",                          
                title: "选择标签",
                width: 650,
                height: 490,
                ondestroy: function (action) {
                  
                    if (action == "ok") {
                        var iframe = this.getIFrameEl();
                        var data = iframe.contentWindow.GetData();
                        data = mini.clone(data);
                        
                        dosetTag(data);
                        
                    }
                }
            });            
             
        } 
        
        
        function dosetTag(tags){
        	var rows = grid1.getSelecteds();
        	var ids = '';
        	for(var i=0;i<rows.length;i++){
        		ids+=rows[i].id+',';
        	}
        	ids = ids.substring(0,ids.length-1); 
            $.ajax({
                url: "/Shelves/setTag",
                type: "post",
                data: { ids:ids,tags:tags},
                dataType:'json',
                success: function (data) {
                	search();
                   
                }
            });
        	
        }

        function cellendedit(e) {
            column = e.column,
                field = e.field,
                value = e.value;

            // 同时更新：毛利，毛利率，银行佣金，增值税等17%
            if(e.record.mall_price>0) {
                e.record.bank_commission = (fmt(e.record.mall_price) * fmt(e.record.by_stages_rate / 100));
                e.record.zengzhishui = (fmt(e.record.mall_price) - fmt(e.record.r_purchase_price)) * 0.07
                e.record.maoli = (fmt(e.record.mall_price) - fmt(e.record.r_purchase_price) + fmt(e.record.rebate) - fmt(e.record.freight) - fmt(e.record.gift_price) - fmt(e.record.bank_commission) - fmt(e.record.zengzhishui) - fmt(e.record.packing_charge));
                e.record.maolilv = e.record.maoli / fmt(e.record.mall_price) * 100;
            }else{
                e.record.bank_commission = 0;
                e.record.zengzhishui = 0;
                e.record.maoli = 0;
                e.record.maolilv = 0;
            }

            if (e.record._state != null) {
                update(mini.encode(e.record));
            }
        }


        function update(data) {

            $.ajax({
                url: "/Shelves/updateShelvesDetailed",
                type: "post",
                data: {
                    data: data
                },
                dataType: 'json',
                success: function (data) {
                    change();
                    //grid2.load({id: id});
                }
            });
        }
  
        
    </script>

<script language="JavaScript">

    function onButtonEditB(e) {
        var btnEdit = this;

        mini.open({
            url:  "/shelves/poplist",
            title: "选择用户",
            width: 650,
            height: 420,
            ondestroy: function (action) {

                if (action == "ok") {
                    var iframe = this.getIFrameEl();

                    var data = iframe.contentWindow.GetData();
                    data = mini.clone(data);
                    btnEdit.setValue(data.id);
                    btnEdit.setText(data.text);
                }
            }
        });

    }

</script>

<script language="JavaScript">

    function copyList() {
        var id = mini.get('combo1').getValue();
        if(id==''){
            mini.alert('请选择清单');
            return;
        }

        var u_code = mini.get('btnEdit1').getValue();
        var u_text = mini.get('btnEdit1').getText();
        if(u_code==''){
            mini.alert('请选择平台');
            return;
        }

        var listType = mini.get('type').getValue();

        mini.prompt("请输入清单名称：", "请输入",
            function (action, value) {
                if (action == "ok") {
                    if(value==''){
                        mini.alert('名称不能为空');
                        return;
                    }
                    //call server
                    $.ajax({
                        url: "/shelves/copyshelveslist",
                        type: "post",
                        data: { listid:id,u_code:u_code,u_text:u_text,listtype:listType,newlistname:value },
                        dataType:'json',
                        success: function (data) {
                            if(data.code!=0){
                                mini.alert('复制成功');
                                mini.get('combo1').setData(data.data);
                                mini.get('combo1').setValue(data.code);
                                change();
                            }
                        }
                    });
                    //self.location.href="/shelves/copyshelveslist/listid/"+id+"/u_code/"+u_code+"/u_text/"+u_text+"/listtype/"+listType+"/newlistname/"+value;
                }

            }
        );

    }

    function exportExcel() {
        var id = mini.get('combo1').getValue();
        if(id==''){
            mini.alert('请选择清单');
            return;
        }
        self.location.href="/shelves/exportexcelshelveslist/listid/"+id;
    }
</script>

<script type="text/javascript">
    var typeOfShipping = [{ id: 0, text: '普通快递' }, { id: 1, text: '顺丰快递'}, { id: 2, text: '物流'}];
</script>

</body>
</block>
<block name="js">
	<script type="text/javascript">
		function save() {
			if ($("input:checked[name='user_id[]']").length < 1) {
				ui_error("请选择用户");
				return false;
			};

			var vars = $("#form_data").serialize();
			sendAjax("{:U('save_user')}", vars, function(data) {
				if (data.status) {
					ui_alert(data.info, function() {
						parent.location.reload(true);
						myclose();
					});
				}
			});

		}
	</script>
</block>